<!DOCTYPE html>
{% load i18n %}
<html lang="zh-CN">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
        <link rel="shortcut icon" type="image/png" href="/static/favicon.ico"/>
        <link rel="apple-touch-icon" href="/static/apple-touch-icon.png">
        {% include 'show/link.html'%}
        <!--- art template web -->
        <!-- ie compatible -->
        <script src="/static/lib/art-template/web-ie-compatible/es5-shim.min.js"></script>
        <script src="/static/lib/art-template/web-ie-compatible/es5-sham.min.js"></script>
        <script src="/static/lib/art-template/web-ie-compatible/json3.min.js"></script>
        <!-- ie compatible end -->
        <script src="/static/lib/art-template/template-web.js"></script>
        <!--- art template web end -->
        <link type="text/css" href="/static/lib/jquery-ui/css/custom-theme/jquery-ui-1.10.0.custom.css" rel="stylesheet"/>
        {% include 'show/common_define.html' %}
        <script src="/static/site/common_func.js"></script>
        <script src="/static/lib/jquery-ui/assets/js/jquery-ui-1.10.0.custom.min.js" type="text/javascript"></script>
        <script src="/static/lib/bootbox.min.js" type="text/javascript"></script>

        <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
        <script src="/static/app/js/layer/layer.js"></script>
	    <script>var page='c2c';</script>
        <script src="/static/app/js/component.js"></script>
        <title>{% trans 'c2c' %}{% trans '充值' %}-{% trans '提现' %}</title>
        <style>
            .pushAd .panel {
                border-radius: 0px;
                border:1px solid #f1f1f1
            }

            .pushAd .panel-heading {
                border-radius: 0px;
            }

            .pushAd .bank_block {
                background:#f9f9f9;
                margin: 5px 10px 5px 10px;
                padding: 20px 20px;
                height: 160px;
                width: 220px;
                border-radius: 5px;
                border: 1px solid rgba(169,191,205 ,0.7); /* 1px, solid 颜色 */
            }

            .pushAd .bank_block .center {
                position:relative; top:40%;
            }

            .bank_block .card-head {
                margin-bottom: 10px;
            }

            .bank_block hr {
                margin: 10px 0px;
            }

            /*---dialog---*/
            .tb-list2 th {
                border: 1px solid #f3da91!important;
                background-color: #fffbef;
                text-align: right;
                height: 28px;
                line-height: 28px;
                padding-right: 15px;
                padding: 5px;
                font-weight: bold;
                border-bottom: 1px solid #dadada;
                border-top: 1px solid #fff;
                color: #666;
                background: #fffcf0;
                padding: 5px 10px;
                font-weight: normal;
                border: 0;
                color: #333;
            }

            .tb-list2 td {
                border: 1px solid #f3da91;
                background-color: #fff;
                text-align: left;
                height: 28px;
                line-height: 28px;
                padding-left: 15px;
            }
        </style>

        <script>
            g_auth = false;
            {% if user.is_authenticated %}
                g_auth = true;
            {% endif %}

            $(document).ready(function() {
                $(".nav-title ul a li").removeClass("active");
                $("#nav_c2c").addClass("active")

                $("#buy_count").keyup(function() {
                    on_buy_count_change()
                });

                $("#sell_count").keyup(function() {
                    on_sell_count_change()
                });

                $("#buy_button").click(function() {
                    on_buy_click()
                });

                $("#sell_button").click(function() {
                    on_sell_click()
                });

                init_bankinfo()
                get_sell()
                get_buy_detail()
                get_amount('bitcny');
            })

            function init_bankinfo() {
                {% if not user.is_authenticated %}
                    return
                {% endif %}

                $.post("{% url 'get_bankinfo' %}", {}, function(data) {
                    //console.log("get bank info" + JSON.stringify(data))
                    //console.log("get bank info" + data.length)
                    var data = {
                        jsonobj : data,
                    }
                    var html = template("temp_bankinfo", data);
                    document.getElementById("bankinfo").innerHTML = html;
                })
            }

            function delete_bankinfo(id) {
                $.post("{% url 'delete_bankinfo' %}", {id:id}, function(data) {
                    init_bankinfo()
                })
            }

            function on_buy_count_change() {
                var buy_count = $("#buy_count").val()
                $("#buy_amount").val(buy_count)
            }

            function on_sell_count_change() {
                var sell_count = $("#sell_count").val()
                var sell_price = $("#sell_price").val()
                var sell_amount = sell_count * sell_price
                $("#sell_amount").val(sell_amount)
            }

            function on_buy_click() {
                $.post("{% url 'buy' %}", $("#buy_form").serialize(), function(ret) {
                    var ret = new Number(ret)
                    if (ret > 0) {
                        var id=ret;
                        msg_tips("{% trans '买入成功,请在24小时内汇款对方' %}", 2000, show_pay_info, id);
                        //show_pay_info(id);
                        get_buy_detail();
                    } //else if (ret == '1') {
                        //$("#buy_msg").html("{% trans '买入失败,最小金额￥100' %}")
                    //}
                    else if (ret == -1) {
                        //$("#buy_msg").html("{% trans '请先添加银行卡' %}")
                        msg_tips("{% trans '请先绑定银行卡' %}" + "<a class=\"red\" href=\"/c2c/addcard?m=1\"> <i class=\"fa fa-plus\"></i> {% trans '添加绑定银行卡' %}</a>", 5000)
                        $("#buy_add_card_tips").show()
                    } else if (ret == -2) {
                        msg_tips("{% trans '系统错误,请联系客服' %}", 3000)
                    } else {
                        msg_tips("{% trans '买入失败' %}", 3000)
                    }
                })
            }

            function on_sell_click() {
                $.post("{% url 'sell' %}", $("#sell_form").serialize(), function(ret) {
                    if (ret == '0') {
                        msg_tips("{% trans '卖出成功' %}", 3000)
                        get_sell()
                    } else if (ret == '1') {
                        msg_tips("{% trans '类型错误错误,请联系管理员' %}", 3000)
                        $("#sell_msg").html("{% trans '类型错误错误,请联系管理员' %}")
                    } else if (ret == '2') {
                        msg_tips("{% trans '请先绑定银行卡' %}" + "<a class=\"red\" href=\"/c2c/addcard?m=1\"> <i class=\"fa fa-plus\"></i> {% trans '添加绑定银行卡' %}</a>", 5000)
                        $("#sell_add_card_tips").show()
                    } else if (ret == '3') {
                        msg_tips("{% trans '卖出数量太小' %}")
                    } else if (ret == '4') {
                        msg_tips("{% trans '卖出数量过大,大于拥有数量' %}")
                    } else {
                        msg_tips("{% trans '服务器错误,卖出失败,请稍后再试' %}")
                    }
                    get_amount('bitcny');
                })
            }

            function show_pay_info(id) {
                $.post("{% url 'buy_bankinfo'%}", {'id':id}, function(data) {
                    //console.log("------------------------------------------")
                    //console.log(data)
                    if (data == 'False') {
                        bootbox.alert("{%trans '系统错误,请联系客服'%}")
                        return
                    }
                    status = "待支付"
                    if (data.status == 0) {
                        status = '待支付'
                    } else if ( data.status == 1) {
                        status = '支付成功'
                    } else if ( data.status == 2) {
                        status = '已撤消'
                    }
                    bootbox.dialog({
                        message:'<div class="panel panel-bm">\n' +
                        '            <div class="panel-body">\n' +
                        '\n' +
                        '                <div class="col-xs-12 col-md-12">\n' +
                        '                    <h5>1.请按提示信息向该卖家汇款;</h5>\n' +
                        '                </div>\n' +
                        '\n' +
                        '                <div class="tdiv">\n' +
                        '    <table width="100%" class="tb-list2">' +
                        '        <tr>' +
                        '            <th scope="row">收款方户名</th>' +
                        '            <td>' + data.bank_account_name + '</td>' +
                        '        </tr>' +
                        '        <tr>' +
                        '            <th scope="row">收款方收款银行</th>' +
                        '            <td>' + data.bank + '</td>' +
                        '        </tr>' +
                        '        <tr>' +
                        '            <th scope="row">收款方开户行</th>' +
                        '            <td>' + data.bank_branch + '</td>' +
                        '        </tr>' +
                        '        <tr>' +
                        '            <th scope="row">收款方账号</th>' +
                        '            <td>' + data.bank_account + '</td>' +
                        '        </tr>' +
                        '        <tr>' +
                        '            <th scope="row">转账金额</th>' +
                        '            <td><b class="red">' + data.amount + '</b></td>' +
                        '        </tr>' +
                        '        <tr>' +
                        '            <th scope="row">汇款时备注内容</th>' +
                        '            <td><b class="red">' + data.code + '</b> (请务必填写)</td>' +
                        '        </tr>' +
                        '                        <tr>\n' +
                        '                            <th scope="row">状态</th>\n' +
                        '                            <td>'+ status+'</td>\n' +
                        '                        </tr>\n' +
                        '\n' +
                        '                    </table>\n' +
                        '                </div>\n' +
                        '\n' +
                        '                <div class="col-xs-12 col-md-12">\n' +
                        '                    <h5>2.卖家为认证商户，可放心付款；</h5>\n' +
                        '                    <h5>3.汇款时请一定要填写备注信息；</h5>\n' +
                        '                    <h5>4.卖家确认收到款后，自动充值BitCNY。如超过24小时未收到币，请向客服反馈解决。</h5>\n' +
                        '                    <h5>5. 请使用<b class="red">本人绑定的银行卡</b>进行汇款，其他任何方式汇款都会退款。（禁止微信和支付宝）</h5>' +
                        '                </div>\n' +
                        '                <p>&nbsp;</p>\n' +
                        '            </div>\n' +
                        '        </div>',
                        title: "{% trans '充值汇款信息' %}",
                        onEscape:true,
                    });
                })
            }

            function on_cancel_deposit_click(id) {
                bootbox.confirm({
                    title: "{% trans '撤销确认'%}",
                    message: "{% trans '确认撤销?' %}",
                    buttons: {
                        cancel: {
                            label: '<i class="fa fa-times"></i> {% trans "取消撤销" %}'
                        },
                        confirm: {
                            label: '<i class="fa fa-check"></i> {% trans "确认撤销" %}'
                        }
                    },
                    callback: function (result) {
                        if (result == true)
                        {
                            on_cancel_deposit_click_internal(id)
                        }
                    }
                });
            }

            function on_cancel_deposit_click_internal(id) {
                if (id == "False") {
                    msg_tips("{% trans '您的订单已在处理中,无法自动撤消,如需强制撤消,请联系客服' %}", 3000)
                    return
                } else if (id == "Cancelled") {
                    msg_tips("{% trans '您的订单已撤消,请勿重复操作' %}", 3000)
                    return
                } else if (id == "Done") {
                    msg_tips("{% trans '您的订单已完成,请勿重复操作' %}", 3000)
                    return
                }

                $.post("{% url 'cancel_deposit' %}", {'id':id}, function(ret) {
                    var ret = new Number(ret)
                    if (ret == '0') {
                        var id=ret;
                        msg_tips("{% trans '撤消成功' %}", 3000);
                        get_buy_detail()
                    } else if (ret == '-1') {
                        msg_tips("{% trans '您的订单已在处理中,无法自动撤消,如需强制撤消,请联系客服' %}", 3000);
                    } else if (ret == '-2') {
                        msg_tips("{% trans '没有您的订单信息,请联系客服解决' %}", 3000);
                    } else if (ret == '-3') {
                        msg_tips("{% trans '系统异常,已回滚' %}", 3000);
                    }  else {
                        msg_tips("{% trans '系统错误,请联系客服' %}", 3000)
                    }
                })
            }

            function on_cancel_withdraw_click(id) {
                if (id == "False") {
                    msg_tips("{% trans '您的订单已在处理中,无法自动撤消,如需强制撤消,请联系客服' %}", 3000)
                    return
                } else if (id == "Cancelled") {
                    msg_tips("{% trans '您的订单已撤消,请勿重复操作' %}", 3000)
                    return
                } else if (id == "Processing") {
                    msg_tips("{% trans '您的订单正在汇款中,请耐心等待' %}", 3000)
                    return
                } else if (id == "Done") {
                    msg_tips("{% trans '您的订单已完成,请勿重复操作' %}", 3000)
                    return
                }

                $.post("{% url 'cancel_withdraw' %}", {'id':id}, function(ret) {
                    if (ret == '0') {
                        msg_tips("{% trans '撤消成功' %}", 3000)
                        get_sell()
                    } else if (ret == '-1') {
                        msg_tips("{% trans '您的订单已在处理中,无法自动撤消,如需强制撤消,请联系客服' %}", 3000);
                    } else if (ret == '-2') {
                        msg_tips("{% trans '没有您的订单信息,请联系客服解决' %}", 3000);
                    } else {
                        msg_tips("{% trans '系统错误,请联系客服' %}", 3000)
                    }
                })
            }
        </script>
    </head>

    <body>
        <div class="main_body">
            <br>
            <div class="pushAd container">
                <div class="col-md-6 f-pz">
                    <div class="panel">
                        <div class="panel-heading">
                            <div class="panel-heading-title">
                                <span class="green" style="font-size:16px; font-weight:bold;">
                                    CNY {% trans '充值' %}
                                </span>
                            </div>
                        </div>
                        <div class="panel-body row">
                            <form class="form-horizontal" id="buy_form" method="post" role="form">

                                <div class="form-group">
                                    <label for="buy_price" class="col-sm-offset-0 col-sm-3 col-xs-offset-1  col-xs-2 control-label">{% trans '买入价格' %}</label>
                                    <div class="col-sm-8 col-xs-8">
                                        <div class="input-group">
                                            <span class="input-group-addon ">CNY</span>
                                            <input type="text" class="form-control " id="buy_price" name="price" disabled="disabled" title="{% trans '买入价格' %}" placeholder="{% trans '买入价格' %}" value="1">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '充值数量' %}</label>
                                    <div class="col-sm-8 col-xs-8">
                                        <div class="input-group">
                                            <span class="input-group-addon "> BitCNY </span>
                                            <input type="text" class="form-control " id="buy_count" name="buy_count" placeholder="{% trans '充值数量' %}">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="buy_amount" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '充值金额' %}</label>
                                    <div class="col-sm-8 col-xs-8">
                                        <div class="input-group">
                                            <span class="input-group-addon ">CNY</span>
                                            <input type="text" class="form-control " disabled="disabled" id="buy_amount" name="count" placeholder="{% trans '金额' %}">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10">
                                        {% if user.is_authenticated %}
                                        <button type="button" id="buy_button" class="btn btn-block btn-success" data-toggle="tooltip">{% trans '充值买入' %} BitCNY</button>
                                        {% else %}
                                        <a href="/users/login?next={%url 'c2c'%}?m=1" class="btn btn btn-block btn-success">{% trans '登录并买入' %} BitCNY</a>
                                        {% endif %}
                                    </div>
                                </div>
                                <div class="col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10">
                                    <p><span class="form-control-static" id="buy_msg" class="red"> </span>
                                    <div id="buy_add_card_tips" class="red" style="display:none">{% trans '请先绑定银行卡信息' %} <a href="/c2c/addcard?m=1"> <i class="fa fa-plus"></i> {% trans '绑定银行卡' %}</a></div>
                                </div>

                                {% csrf_token %}
                            </form>
                        </div>
                    </div>
                </div>
                <div class="col-md-6 f-pz">
                    <div class="panel">
                        <div class="panel-heading">
                            <div class="panel-heading-title">
                                <span class="red" style="font-size:16px; font-weight:bold;">
                                    CNY {% trans '提现' %}
                                </span>
                                <span class="gray f-fr" style="font-size:12px;">
                                    {% trans '可提现余额: '%}<span id="bitcny_balance" class="red">0.00</span> BitCNY
                                </span>
                            </div>
                        </div>
                        <div class="panel-body row">
                            <form class="form-horizontal" id="sell_form" method="post" role="form">

                                <div class="form-group">
                                    <label for="sell_price" class="col-sm-offset-0 col-sm-3 col-xs-offset-1  col-xs-2 control-label">{% trans '卖出价格' %}</label>
                                    <div class="col-sm-8 col-xs-8">
                                        <div class="input-group">
                                            <span class="input-group-addon svg_red red">CNY</span>
                                            <input type="text" class="form-control red" id="sell_price" name="price" disabled="disabled" title="{% trans '卖出价格' %}" placeholder="{% trans '卖出价格' %}" value="0.995">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '卖出数量' %}</label>
                                    <div class="col-sm-8 col-xs-8">
                                        <div class="input-group">
                                            <span class="input-group-addon svg_red red"> BitCNY </span>
                                            <input type="text" class="form-control red" id="sell_count" name="sell_count" placeholder="{% trans '卖出数量' %}">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="sell_amount" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '提现金额' %}</label>
                                    <div class="col-sm-8 col-xs-8">
                                        <div class="input-group">
                                            <span class="input-group-addon svg_red red">CNY</span>
                                            <input type="text" class="form-control red" disabled="disabled" id="sell_amount" name="count" placeholder="{% trans '提现金额' %}">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10">
                                        {% if user.is_authenticated %}
                                        <button type="button" id="sell_button" class="btn btn-block btn-danger" data-toggle="tooltip">{% trans '提现卖出' %} BitCNY</button>
                                        {% else %}
                                        <a href="/users/login?next={%url 'c2c'%}?m=1" class="btn btn btn-block btn-danger">{% trans '登录并卖出' %} BitCNY</a>
                                        {% endif %}
                                    </div>
                                </div>
                                <div class="col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10">
                                    <p><span class="form-control-static red" id="sell_msg"></span>
                                    <div id="sell_add_card_tips" class="red" style="display:none">{% trans '请先添加银行卡信息' %} <a href="/c2c/addcard?m=1"> <i class="fa fa-plus"></i>{% trans '添加银行卡' %}</a></div>
                                </div>

                                {% csrf_token %}
                            </form>
                        </div>
                    </div>
                </div>
                <!--
                <div class="col-md-6 f-pz">
                    <div class="panel">
                        <div class="panel-heading">
                            <div class="panel-heading-title">
                                {% trans '最新买入' %}
                            </div>
                        </div>
                        <div class="panel-body row" >
                        </div>
                    </div>
                </div>
                <div class="col-md-6 f-pz">
                    <div class="panel">
                        <div class="panel-heading">
                            <div class="panel-heading-title">
                                {% trans '最新卖出' %}
                            </div>
                        </div>
                        <div class="panel-body row" >
                        </div>
                    </div>
                </div>
                -->
                <div class="col-md-12 f-pz">
                    <div class="panel">
                        <div class="panel-body row">
                            <div class="alert alert-warning alert-dismissible" role="alert">
                                {% blocktrans %}
                                1. C2C交易为用户之间点对点的交易，直接转账打币，平台不接受充值汇款<br>
                                2. 买卖商户均为实名认证商户，并提供保证金，可放心兑换<br>
                                3. 如需申请成为商户请发邮件到webmaster@NiuBiEX.com <br>
                                4. 请使用本人绑定的银行卡进行汇款，其他任何方式汇款都会退款。（禁止微信和支付宝） <br>
                                5. 商家一般接单后2小时内会完成打款。 <br>
                                {% endblocktrans %}
                            </div>
                        </div>
                    </div>
                </div>

                <div class="col-md-12 f-pz">
                    <div id="bankinfo">
                    </div>
                </div>
                <!-- 交易记录-->
                <div class="col-md-6">
                    <div id="buy_detail"></div>
                </div>
                <div class="col-md-6">
                    <div id="sell_detail"></div>
                </div>
            </div>
        </div><!-- end container-->
    </div><!-- end main_body-->
</body>
</html>

<script id="temp_bankinfo" type="text/html">
    <div class="panel">
        <div class="panel-heading green">
            <i class="fa fa-credit-card"></i> {% trans '我的银行卡' %}
        </div>
        <div class="panel-body">
            <%if (jsonobj.length == 0) { %>
                <div class="col-xs-6 col-md-3 bank_block">
                    <div class="center f-center">
                        <p style="font-size:18px;">
                        <a href="/c2c/addcard?m=1"> <i class="fa fa-plus"></i>{% trans '添加银行卡' %}</a>
                        </p>
                    </div>
                </div>

                <% } else if (jsonobj.length > 0) { %>
                <div class="col-xs-6 col-md-3 bank_block" style="background:#f9f9f9">
                    <div class="inner">
                        <div class="card-head">
                            <b> <%=jsonobj[0].bank%> </b>
                            <a href="#"><span class="f-fr delete" data-id="43978" onclick="delete_bankinfo(<%=jsonobj[0].id%>)"><i class="fa fa-trash-o"></i>{% trans '删除' %}</span></a>
                        </div>
                        <hr>
                        <div class="card-body" sytel="color:#e9e9e9">
                            <p><%=jsonobj[0].bank_account_name%></p>
                            <p style="font-size:18px;">
                            <%=jsonobj[0].bank_account%>
                            </p>
                        </div>
                        <div class="bank_foot">
                            {% trans '支行:' %}<%=jsonobj[0].bank_branch%>
                        </div>
                    </div>
                </div>
                <% } %>
        </div>
    </div>
</script>

<script>
    function get_buy_detail() {
        // var userid = $("#userid").val();
        console.log("get deposites legal")
        $.post("{% url 'get_c2c_buy'%}",
        {},
        function(legal_data) {
            console.log("buy_detail" + JSON.stringify(legal_data))
            var data1 = legal_data.reverse()
            var data2 = {
                jsonobj: data1,
            }
            var html = template('temp_buy_detail', data2);
            document.getElementById('buy_detail').innerHTML = html;
        }
        );
    }

    function get_sell() {
        // var userid = $("#userid").val();
        console.log("get sell legal")
        $.post("{% url 'get_c2c_sell'%}",
        {},
        function(legal_data) {
            console.log("sell_detail" + JSON.stringify(legal_data))
            var data = legal_data.reverse()
            var data = {
                jsonobj: data,
            }
            var html = template('temp_sell_detail', data);
            document.getElementById('sell_detail').innerHTML = html;
        }
        );
    }

    function get_amount(coin_type) {
        if (!g_auth) {
            return
        }
        var userid = $("#userid").val();
        var amount = 0;
        var freeze = 0;
        $.post("/btc/get_amount",
        {coin_type: coin_type},
        function(data) {
            amount = data['amount']
            tofixed = 2
            new_amount = floor_number(amount, tofixed)
            $("#bitcny_balance").html(new_amount);
        })
    }
</script>

<script id="temp_buy_detail" type="text/html">
    <div class="row">
        <div class="panel indexBlockList">
            <div class="panel-heading">
                <span class="green">
                    <i class="fa fa-list"></i>{% trans '最新买入' %}
                </span>
            </div>
            <div class="panel-body">
                <table class="table table-hover">
                    <thead>
                        <th>{% trans '时间'%} </th>
                        <th>{% trans '单价'%}</th>
                        <th>{% trans '总价'%}</th>
                        <th>{% trans '状态'%}</th>
                        <th><span class="f-fr">{% trans '详情'%}</span></th>
                        <th>{% trans '撤销'%}</th>
                    </thead>
                    <tbody class="svg_green green">
                        <% for (i = 0; i < jsonobj.length; i++) { %>
                            <% var info = jsonobj[i] %>
                            <% var create_time = $imports.dateFormat(info.create_time) %>
                            <% var amount = info.amount * 1 %>
                            <% var status1 = info.status %>
                            <% var pay_type = info.pay_type %>
                            <% var do_id = info.id %>
                            <% var status = "{% trans '待付款' %}" %>
                            <% if (status1 == 1) { %>
                                <% status = "{% trans '付款成功,审核中'%}" %>
                            <% } %>
                            <% if (status1 == 2) { %>
                                <% status = "{% trans '已撤消'%}" %>
                            <% } %>
                            <% if (status1 == 3) { %>
                                <% status = "{% trans '审核通过,正在入账'%}" %>
                            <% } %>
                            <% if (status1 == 4) { %>
                                <% status = "{% trans '成功'%}" %>
                            <% } %>
                            <% if (status1 == 5) { %>
                                <% status = "{% trans '撤消成功'%}" %>
                            <% } %>
                            <tr>
                                <td><%=create_time%></td>
                                <td><%=info.price%></td>
                                <td><%=amount%></td>
                                <td><%=status%></td>
                                <td>
                                    <% if (status1 == 0) { %>
                                        <a href="javascript:void(0)" class="red f-fr" onclick="show_pay_info(<%=info.id%>)"><i class="fa fa-credit-card"></i>{% trans '付款信息' %}</a>
                                    <% } else { %>
                                        <span class="f-fr red">----</span>
                                    <% } %>
                                </td>
                                <% if (status1 == 0) { %>
                                    <td><a href="javascript:void(0)" onclick="on_cancel_deposit_click(<%=do_id%>)">{% trans '撤销' %}</a></td>
                                <% } else if (status1 == 2 || status1 == 5) { %>
                                    <td><a href="javascript:void(0)" onclick="on_cancel_deposit_click('Cancelled')">{% trans '撤销' %}</a></td>
                                <% } else if (status1 == 4) { %>
                                    <td><a href="javascript:void(0)" onclick="on_cancel_deposit_click('Done')">{% trans '撤销' %}</a></td>
                                <% } else { %>
                                    <td><a href="javascript:void(0)" onclick="on_cancel_deposit_click('False')">{% trans '撤销' %}</a></td>
                                <% } %>
                            </tr>
                            <%}%>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</script>

<script id="temp_sell_detail" type="text/html">
    <div class="row">
        <div class="panel indexBlockList">
            <div class="panel-heading">
                <span class="red">
                    <i class="fa fa-list"></i> {% trans '最新卖出' %}
                </span>
            </div>
            <div class="panel-body">
                <table class="table table-hover">
                    <thead>
                        <tr class="bg-white">
                            <th>{% trans '时间' %}</th>
                            <th>{% trans '单价' %}</th>
                            <th>{% trans '总价' %}</th>
                            <th>{% trans '状态' %}</th>
                            <th>{% trans '撤销' %}</th>
                        </tr>
                    </thead>
                    <tbody class="svg_green green">
                        <% for (i = 0; i < jsonobj.length; i++) { %>
                            <% var info = jsonobj[i] %>
                            <% var create_time = $imports.dateFormat(info.create_time) %>
                            <% var amount = info.amount * 1 %>
                            <% var status1 = info.status %>
                            <% var status = "{% trans '正在处理' %}" %>
                            <% if (status1 == 1) { %>
                                <% status = "{% trans '打款成功' %}" %>
                            <% } else if (status1 == 2) { %>
                                <% status = "{% trans '打款失败'%}" %>
                            <% } else if (status1 == 3) { %>
                                <% status = "{% trans '已撤消'%}" %>
                            <% } else if (status1 == 4) { %>
                                <% status = "{% trans '汇款中'%}" %>
                            <% } else if (status1 == 5) { %>
                                <% status = "{% trans '撤消成功'%}" %>
                            <% } %>
                            <% var wo_id = info.id %>
                            <tr>
                                <td><%=create_time%></td>
                                <td>0.995</td>
                                <td><%=amount%></td>
                                <td><%=status%></td>
                                <% if (status1 == 0) { %>
                                    <td><a href="javascript:void(0)" onclick="on_cancel_withdraw_click(<%=wo_id%>)">{% trans '撤销' %}</a></td>
                                <% } else if (status1 == 3 || status1 == 5) { %>
                                    <td><a href="javascript:void(0)" onclick="on_cancel_withdraw_click('Cancelled')">{% trans '撤销' %}</a></td>
                                <% } else if (status1 == 4) { %>
                                    <td><a href="javascript:void(0)" onclick="on_cancel_withdraw_click('Processing')">{% trans '撤销' %}</a></td>
                                <% } else if (status1 == 1) { %>
                                    <td><a href="javascript:void(0)" onclick="on_cancel_withdraw_click('Done')">{% trans '撤销' %}</a></td>
                                <% } else { %>
                                    <td><a href="javascript:void(0)" onclick="on_cancel_withdraw_click('False')">{% trans '撤销' %}</a></td>
                                <% } %>
                            </tr>
                        <% } %>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</script>
